package com.hita.tata.bbs.account.web;

import com.hita.tata.bbs.account.param.request.LoginForm;
import com.hita.tata.bbs.account.service.AccountService;
import com.hita.tata.common.entity.response.ResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "account")
public class AccountController {
	@Autowired
	private AccountService accountService;

	/**
	 * 用户登录
	 * 登录成功：返回用户基本信息
	 * 登录失败：返回失败信息
	 * @param loginForm
	 * @return
	 */
	@RequestMapping(
			value = {"login"},
			method = RequestMethod.POST
	)
	public ResponseMessage checkLogin(@RequestBody LoginForm loginForm) {
		System.out.println(loginForm.getUserId());
		System.out.println(loginForm.getPassword());
		return accountService.checkLogin(loginForm);
	}
}
